﻿@using Dal.Models
@model CHACTOR
@{
    Layout = null;
    ViewBag.Nav = 3;
    ViewBag.Menu = 0;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    @Html.Partial("meta")
</head>
<body id="b_main">
    @Html.Partial("header")
    <!--/end #header-->
    <div id="wrapper">
        <!--holds pretty much everything-->
        <div id="content">
            @Html.Partial("nav")
            @using (Html.BeginForm("Add", "Tongxun", FormMethod.Post, new { @class = "broom_form", id = "form0", style = "margin-left: 30px;" }))
            {
                <table border="0" cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="even">
                            <td colspan="3">
                                添加通讯录<span style="color: red">(电话号码相同的联系人,会覆盖旧的姓名邮件地址等信息)</span>
                            </td>
                        </tr>
                        <tr class="odd">
                            <td>
                                姓名
                                @Html.TextBoxFor(i => i.NAME, new { @class = "inputbox" })
                            </td>
                            <td>
                                电话
                                @Html.TextBoxFor(i => i.PHONE, new { @class = "inputbox" })
                            </td>
                            <td>
                                邮件
                                @Html.TextBoxFor(i => i.EMAIL, new { @class = "inputbox" })
                            </td>
                        </tr>
                        <tr class="even">
                            <td>
                                地址
                                @Html.TextBoxFor(i => i.ADDRESS, new { @class = "inputbox" })
                            </td>
                            <td>
                                分组
                                @Html.TextBoxFor(i => i.TEAM, new { @class = "inputbox" })
                            </td>
                            <td>
                                <input type="submit" name="search" value="添加" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            }
            @if (ViewBag.Result != null)
            {
                if (ViewBag.Result == true)
                {
                <div class="notification confirm">
                    <a class="close" href="#"></a><em>
                        <img src="/assets/img/icons/tick_circle.png" alt="" />操作成功 </em>
                </div>
                }
                else
                {
                <div class="notification error">
                    <a class="close" href="#"></a><em>
                        <img alt="" src="/assets/img/icons/cross_circle.png">未搜索到数据,请尝试其他搜索条件</em>
                </div>

                }
            }
            <br />
            <br />
            @using (Html.BeginForm("BatchAdd", "Tongxun", FormMethod.Post, new { @class = "broom_form", id = "form0", style = "margin-left: 30px;", enctype = "multipart/form-data" }))
            {
                <table border="0" cellspacing="0" summary="table" class="broom_table">
                    <tbody>
                        <tr class="even">
                            <td colspan="3">
                                批量导入通讯录(xls)(电话号码相同的联系人,会覆盖旧的姓名邮件地址等信息)
                            </td>
                        </tr>
                        <tr class="odd">
                            <td>
                                上传通讯录
                            </td>
                            <td>
                                <input type="file" name="tongxunFile" /> <a href="/assets/sample.xlsx" target="_blank">通讯录样例</a>
                            </td>
                            <td>
                                <input type="submit" name="search" value="开始导入" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            }
        </div>
    </div>
    <div class="clear">
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("form").first().validate({
                rules: {
                    NAME: { required: true, maxlength: 50 },
                    PHONE: { required: true, isPhone: true },
                    EMAIL: { required: false, email: true, maxlength: 50 },
                    ADDRESS: { required: false, maxlength: 50 },
                    TEAM: { required: false, maxlength: 50 }
                }
            });
        });
    </script>
</body>
</html>
